<template>
    <div>
        <div class="outmain ba_f">
            <div class="shuju_title mar_b20">
                <div class="shuju_title_text">
                    <span>授权详情</span>
                </div>
            </div>
            <el-form ref="form" :model="form" label-width="180px">
                <el-form-item label="站点ID">
                    <div>{{form.id}}</div>
                </el-form-item>
                <el-form-item label="服务类型">
                    <div>{{form.service_type}}</div>
                </el-form-item>
                <el-form-item label="授权状态">
                    <div>
                        <el-tag type="success" v-show="form.status=='1'">已授权</el-tag>
                        <el-tag type="danger" v-show="form.status=='2'">未授权</el-tag>
                        <el-tag type="info" v-show="form.status=='3'">已到期</el-tag>
                    </div>
                </el-form-item>
                <el-form-item label="可创建账号数量">
                    <div v-if="form.account_type=='2'">{{form.account_number}}</div>
                    <div v-if="form.account_type=='1'">无限</div>
                </el-form-item>
                <el-form-item label="网站URL">
                    <el-input auto-complete="off" placeholder="网站url" v-model="form.domain_url" disabled class="elinputs"></el-input>
                </el-form-item>
                <el-form-item label="站点IP">
                    <el-input auto-complete="off" placeholder="站点IP" v-model="form.ip_address" disabled class="elinputs"></el-input>
                </el-form-item>
                <el-form-item label="授权码">
                    <el-input auto-complete="off" placeholder="授权码"  v-model="form.auth_code" disabled class="elinputs"></el-input>
                    <div class="yb_margin lh16">温馨提示：如授权码失效，请将网站域名以及站点ID提交给客服；请保护好您的授权码，避免泄露</div>
                </el-form-item>
                <el-form-item label="到期时间">
                    <el-input auto-complete="off" placeholder="到期时间" v-model="form.time_end" disabled class="elinputs" v-if="form.time_type=='2'"></el-input>
                    <el-input auto-complete="off" placeholder="无限" disabled class="elinputs" v-if="form.time_type=='1'"></el-input>
                </el-form-item>
            </el-form>
        </div>
<!--        <div class="mar_t20 ba_f pad_20 t_c">-->
<!--            <el-button type="primary" @click="onSubmit">保存</el-button>-->
<!--        </div>-->
    </div>
</template>
<script>
    import {getAuthInfo} from "@/api/setup";
    export default {
        created() {
            this.bus.$emit('loading', true);
            this.init();
        },
        data() {
            return {
                form: {
                    account_number: '',
                    account_type: '',
                    service_type: '',
                    auth_code: '',
                    domain_url: '',
                    id: '',
                    ip_address: '',
                    status: '',
                    time_end: '',
                    time_type: '',
                }
            }
        },
        methods: {
            async init() {
                const {data} = await getAuthInfo();
                // console.log(data)
                this.form2 = this.form
                this.form = Object.assign(this.form2, data);
                this.bus.$emit('loading', false)
            },
        }
    }
</script>
